import axios from '../request'

//注册接口
export const registerApi = (name, pwd, phone) => axios.post('user/register', {
  //  "name":name,
  "username": name,
  "password": pwd,
  "phone": phone
})
export const sendDuanxin = (phoneNumber) => axios.get(`/SendSms/${phoneNumber}`)
//登录接口
export const loginApi = (username, password, rememberme,) => axios.post('/login', {
  username,
  password,
  rememberme
})
// 上传头像
export const uploadFaceBase64 = (userId, faceData) => axios.post('user/uploadFaceBase64', {
  "userId": userId,
  "faceData": faceData
})
// 修改昵称
export const setNickname = (id, nickname) => axios.post('user/setNickname', {
  "id": id,
  "nickname": nickname
})
// 修改密码
export const updatePassword = (id, oldPassword, newPassword) => axios.post('user/updatepassword', {
  "id": id,
  "oldPassword": oldPassword,
  "newPassword": newPassword
})
// 查询好友
export const searchFriend = (friendUserName, myUserId) => axios.post('user/searchFriend', {
  "friendUserName": friendUserName,
  "myUserId": myUserId
})
// 发送好友请求
export const sendFriendRequest = (friendUserName, myUserId) => axios.post('user/addFriendRequest', {
  "friendUserName": friendUserName,
  "myUserId": myUserId
})
// 接收的好友请求消息
export const queryFriendRequest = (acceptUserId) => axios.post('user/queryFriendRequest', {
  "acceptUserId": acceptUserId
})
// 处理好友请求消息
export const operFriendRequest = (acceptUserId, sendUserId, operType) => axios.post('user/operFriendRequest', {
  "acceptUserId": acceptUserId,
  "sendUserId": sendUserId,
  "operType": operType
})
// 渲染好友列表
export const showMyFriend = (myUserId) => axios.post('user/showMyFriend', {
  "myUserId": myUserId
})
// 删除好友
export const deleteFriend = (myFriendUserId) => axios.post('user/deleteFriend', {
  "myFriendUserId": myFriendUserId
})
// 聊天的时候检测好友
export const selectMyFriendIsExist = (myUserId, myFriendUserId) => axios.post('user/selectMyFriendIsExist', {
  "myUserId": myUserId,
  "myFriendUserId": myFriendUserId
})
// 根据id获取好友信息
export const getUserById = (Id) => axios.post('user/getUserById', {
  "id": Id
})
// 获取首页文章信息、动态信息
export const getArticleMessage = () => axios.get('index')
// 获取评论详情：
export const getDetailMessage = (id, userId) => axios.post('discuss/detail', {
  "id": id,
  "userId": userId
})
// 给帖子点赞的接口
export const likeArticle = (userId, entityId) => axios.post('like', {
  "userId": userId,
  "entityType": 1,
  "entityId": entityId,
  "entityUserId": null
})
// 二级评论点赞
export const likeMessageFirst = (userId, entityId, entityUserId) => axios.post('like', {
  "userId": userId,
  "entityType": 2,
  "entityId": entityId,
  "entityUserId": null
})
// 二级评论点赞
export const likeMessageSecond = (userId, entityId, entityUserId) => axios.post('like', {
  "userId": userId,
  "entityType": 2,
  "entityId": entityId,
  "entityUserId": entityUserId
})
// 对帖子发布评论：
export const addComment = (userId, content, entityId) => axios.post('comment/addComment', {
  "userId": userId,
  "entityType": 1,
  "content": content,
  "entityId": entityId,
  "targetId": null
})
// 对评论回复评论：
export const addCommentFirst = (userId, targetId, content, entityId) => axios.post('comment/addComment', {
  "userId": userId,
  "entityType": 2,
  "content": content,
  "entityId": entityId,
  "targetId": targetId
})
// 发布帖子：
export const discussAdd = (userId, title, content, faceData) => axios.post('discuss/add', {
  "userId": userId,
  "title": title,
  "content": content,
  "faceData": faceData
})
// 忘记密码
export const forgetPassword = (username, phone, password) => axios.post('forget', {
  "username": username,
  "phone": phone,
  "password": password
})